Returning a Value from a Workflow

An invoked workflow can optionally return a result.

To create a solution that involves invoking a workflow that returns a result, you must:

  1. Specify the type of the result that the invoked workflow returns.

  2. Set the value of the result within the invoked workflow.

  3. Retrieve the result of the invoked workflow once it has completed.

Specify the Type of REsult Returned

On the workflow screen, choose the result type from the Workflow Result Type dropdown list.

Only simple types can be selected.

Set the value of the Workflow Result

Within the invoked workflow, specify the value of its result using the Set Result method of the invoked workflow, for example:

Retrieve the Result of an Invoked Worflow

To retrieve the result of an invoked workflow, use the Get Result method of the invoked workflow.

For example, in the workflow below, the first step invokes the Calculate BMI workflow and the second step retrieves the result of that workflow.

However, it is important to ensure that the invoked workflow has ended before retrieving its result. To do so:

  • The Start method (to invoke the workflow) and the Get Result method (to retrieve the result) should be in separate steps.

  • The transition into the step that retrieves the result should be delayed until the invoked workflow has ended, typically using the Ended event of the invoked workflow, as below.